﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ResourceBlender_Express {
    /// <summary>
    /// A simple text editor which has buttons for undo, redo, cut, copy and paste
    /// </summary>
    public partial class WinFullEditor : Window {
        /// <summary>
        /// Gets or sets the text being edited.
        /// </summary>
        /// <value>The text being edited.</value>
        public string Text {
            get { return txt.Text; }
            set { txt.Text = value; }
        }

        /// <summary>
        /// Initializes a new <see cref="WinFullEditor"/>.
        /// </summary>
        public WinFullEditor() {
            InitializeComponent();
        }

        /// <summary>
        /// Initializes a new <see cref="WinFullEditor"/> to edit the specified text.
        /// </summary>
        /// <param name="caption">The window caption.</param>
        /// <param name="text">The text to edit.</param>
        public WinFullEditor(string caption, string text)
            : this() {
            Title = caption;
            Text = text;
        }

        /// <summary>
        /// Closes the dialog, returning a DialogResult of <c>true</c>
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void btnReturn_Click(object sender, RoutedEventArgs e) {
            this.DialogResult = true;
            Close();
        }

        /// <summary>
        /// Closes the dialog
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void btnCancel_Click(object sender, RoutedEventArgs e) {
            Close();
        }
    }
}
